Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huge amount of memory used #52

Open
TadeasKriz opened this issue Jan 5, 2016 · 5 comments
Open

Huge amount of memory used #52

TadeasKriz opened this issue Jan 5, 2016 · 5 comments

Comments

@TadeasKriz
Copy link

@TadeasKriz TadeasKriz commented Jan 5, 2016

I have quite a large stylesheet file (2048 lines) and I found out that InterfaCSS takes awful lot of RAM. I run profiling and found out that InterfaCSS keeps allocated about 260MB of RAM. Most of the trace seems to be in [Parcoa parse].

Is this normal? And is it because of the large file? Even if I split it to multiple CSS files, I will still need to load them sooner or later and will get the memory usage that high again.

Any ideas?

@TadeasKriz
Copy link
Author

@TadeasKriz TadeasKriz commented Jan 5, 2016

It is linked to file size then. I tried removing half of the file (making it 1024 lines) and the memory was "only" 80MB (which is still around 80% of the whole app's memory consumption).

Is there any way to mitigate this?

@tolo
Copy link
Owner

@tolo tolo commented Jan 8, 2016

I haven't observed this before myself, and I'm not able to reproduce it currently either. I didn't have any stylesheet quite as large as that handy, but I fiddled with the main.css file of the SimpleSample demo project to make it about a thousand lines long, but that didn't seem to affect memory usage.

Have you been able to pinpoint any specific style declarations that seem to result in this behaviour?

@tolo
Copy link
Owner

@tolo tolo commented Feb 27, 2016

Hi again,

Have you been able to figure out anything more about what conditions seem to be causing the large memory footprint?

@TadeasKriz
Copy link
Author

@TadeasKriz TadeasKriz commented Feb 27, 2016

Hey, I'm sorry for no response from me. I found out that the memory consumption rose probably quadratically with the size of the stylesheet file. Also the startup of the application was very slow due to the file size. Unfortunately I had to fix it as soon as I could and since I'm no good with parsers, I wrote a very simple library for styling in Swift to cut down on the memory and computation requirements.

@tolo
Copy link
Owner

@tolo tolo commented Feb 27, 2016

Hi, no worries, thanks for getting back on this.

A quadratic memory increase sounds bad indeed - could you mention something more about how your styles are organized? Or if you have an example stylesheet that you can share, that would be really helpful, since I've been unable to reproduce the memory issues thus far. If so, you can mail it to me directly if you wish.

Also, note that the stylesheet parsing performance has been significantly improved as of 1.4, mostly due to the use of a custom, more efficient, parser combinator framework. It may be that the introduction of this framework has had effects on memory consumption as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.