{"action":"created","issue":{"url":"https://api.github.com/repos/libgdx/libgdx/issues/3912","repository_url":"https://api.github.com/repos/libgdx/libgdx","labels_url":"https://api.github.com/repos/libgdx/libgdx/issues/3912/labels{/name}","comments_url":"https://api.github.com/repos/libgdx/libgdx/issues/3912/comments","events_url":"https://api.github.com/repos/libgdx/libgdx/issues/3912/events","html_url":"https://github.com/libgdx/libgdx/issues/3912","id":139433875,"number":3912,"title":"Sudden CPU spikes w. specific amount of chars in scene2d text-widgets","user":{"login":"adcgx","id":17733587,"avatar_url":"https://avatars.githubusercontent.com/u/17733587?v=3","gravatar_id":"","url":"https://api.github.com/users/adcgx","html_url":"https://github.com/adcgx","followers_url":"https://api.github.com/users/adcgx/followers","following_url":"https://api.github.com/users/adcgx/following{/other_user}","gists_url":"https://api.github.com/users/adcgx/gists{/gist_id}","starred_url":"https://api.github.com/users/adcgx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adcgx/subscriptions","organizations_url":"https://api.github.com/users/adcgx/orgs","repos_url":"https://api.github.com/users/adcgx/repos","events_url":"https://api.github.com/users/adcgx/events{/privacy}","received_events_url":"https://api.github.com/users/adcgx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-09T00:18:34Z","updated_at":"2016-03-10T21:51:47Z","closed_at":null,"body":"#### Issue details\r\nDisplaying a certain number of chars in a TextArea / TextField / Label (I'm suspecting pretty much everything than renders BitmapFonts?) on a stage, causes sudden increase in CPU usage. The exact number of chars differs depending on unknown circumstances (which font used perhaps?). In the test below, going from 33 to 34 chars in the TextArea (and again from 42 -> 43) causes huge increase in CPU usage. Only tested on desktop/windows. If you get this bug, but the number of chars needed to reproduce is different, please post how many.\r\n\r\n#### Reproduction steps/code\r\n```\r\nimport com.badlogic.gdx.*;\r\nimport com.badlogic.gdx.backends.lwjgl.LwjglApplication;\r\nimport com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;\r\nimport com.badlogic.gdx.graphics.GL20;\r\nimport com.badlogic.gdx.scenes.scene2d.Stage;\r\nimport com.badlogic.gdx.scenes.scene2d.ui.*;\r\n\r\n// Notice how CPU usage will spike at 34 chars, and then spike even further at 43\r\n\r\npublic class DesktopLauncher extends ApplicationAdapter {\r\n\tStage stage;\r\n\tTextArea textArea;\r\n\r\n\tpublic void create () {\r\n\t\tstage = new Stage();\r\n\t\tGdx.input.setInputProcessor(stage);\r\n\t\tSkin skin = new Skin(Gdx.files.internal(\"data/uiskin.json\"));\r\n\t\ttextArea = new TextArea(\"TextArea test\", skin);\r\n\t\ttextArea.setWidth(400);\r\n\t\ttextArea.setHeight(400);\r\n\t\ttextArea.setPosition(40, 70);\r\n\t\tstage.addActor(textArea);\r\n\r\n\t}\r\n\r\n\tpublic void render () {\r\n\t\tGdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);\r\n\t\tstage.act();\r\n\t\tstage.draw();\r\n\t}\r\n\r\n\tpublic void resize (int width, int height) {\r\n\t\tstage.getViewport().update(width, height, true);\r\n\t}\r\n\r\n\tpublic static void main (String[] args) throws Exception {\r\n\t\tLwjglApplicationConfiguration config = new LwjglApplicationConfiguration();\r\n\t\tconfig.foregroundFPS = 0;\r\n\t\tconfig.vSyncEnabled = true;\r\n\t\tnew LwjglApplication(new DesktopLauncher(), config);\r\n\t}\r\n}\r\n```\r\n#### Version of LibGDX and/or relevant dependencies\r\nTested: 1.7.1 + 1.9.2\r\n\r\n#### Please select the affected platforms\r\n- [ ] Android\r\n- [ ] iOS\r\n- [ ] HTML/GWT\r\n- [x] Windows\r\n- [ ] Linux\r\n- [ ] MacOS\r\n"},"comment":{"url":"https://api.github.com/repos/libgdx/libgdx/issues/comments/195067391","html_url":"https://github.com/libgdx/libgdx/issues/3912#issuecomment-195067391","issue_url":"https://api.github.com/repos/libgdx/libgdx/issues/3912","id":195067391,"user":{"login":"xoppa","id":2349087,"avatar_url":"https://avatars.githubusercontent.com/u/2349087?v=3","gravatar_id":"","url":"https://api.github.com/users/xoppa","html_url":"https://github.com/xoppa","followers_url":"https://api.github.com/users/xoppa/followers","following_url":"https://api.github.com/users/xoppa/following{/other_user}","gists_url":"https://api.github.com/users/xoppa/gists{/gist_id}","starred_url":"https://api.github.com/users/xoppa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xoppa/subscriptions","organizations_url":"https://api.github.com/users/xoppa/orgs","repos_url":"https://api.github.com/users/xoppa/repos","events_url":"https://api.github.com/users/xoppa/events{/privacy}","received_events_url":"https://api.github.com/users/xoppa/received_events","type":"User","site_admin":false},"created_at":"2016-03-10T21:51:47Z","updated_at":"2016-03-10T21:51:47Z","body":"Can reproduce the issue. Although, at least in my tests, it seems like the high cpu usage is not constant. E.g. the cpu usage might drop after a while to normal values. If I understand correctly, @Tom-Ski had some more constant results in reproducing it. I could not reproduce it on LWJGL3. With `LwjglApplicationConfiguration#useGL30` set to true it seems like to be even better reproducible.\r\n\r\nSpriteBatch uses VertexArray (when not gles3), using VBO instead seems one way to fix this issue. I think that SpriteBatch might use VA instead of VBO based on tests which might be somewhat outdated now that gles1 is no longer supported. Therefor I added a deprecated `SpriteBatch.defaultVertexDataType` member for easy testing the difference between the two.\r\n\r\nCould you check whether, with latest nightly, adding the following line in your create method fixes it?\r\n```java\r\nSpriteBatch.defaultVertexDataType = VertexDataType.VertexBufferObject;\r\n```"}}