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

Fix size of stringification buffers #172

Merged
merged 2 commits into from Jan 22, 2018

Conversation

Projects
None yet
2 participants
@hellerve
Contributor

hellerve commented Jan 22, 2018

This PR introduces some logic to calculate the buffer length needed for the stringification of everything. This is most impactful on Arrays and Deftypes, but has an impact on all primitives. This should both reduce the brittleness of Array and Deftype stringification, and reduce the memory footprint of Carp as a whole, since no wasteful bytes are allocated anymore.

Cheers

@eriksvedang

This comment has been minimized.

Collaborator

eriksvedang commented Jan 22, 2018

First of all – this PR is awesome, I was scared of fixing the string allocations so thanks a lot for working through that!

Some minor feedback:

  • The formatting of the template generated code could be a little nicer, with proper indentation and some newlines removed.
  • There is an assertion lingering in the array string function (line 444) that can be removed now.

I'll make sure to add memory tests for the string functions as soon as I can, for now it seems like you got everything right – fingers crossed :)

@eriksvedang eriksvedang merged commit edffb43 into carp-lang:master Jan 22, 2018

@eriksvedang

This comment has been minimized.

Collaborator

eriksvedang commented Jan 22, 2018

⭐️⭐️⭐️⭐️⭐️

@hellerve hellerve deleted the hellerve:stringification-size branch Feb 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment