Skip to content

Filters stream rebound #948

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

Merged
merged 21 commits into from
Feb 13, 2015

Conversation

nulltoken
Copy link
Member

Warning: This relies on a libgit2 private build from libgit2/libgit2#2892 which isn't merged yet.

Besides the minor fixes, this tries to provide a more stream-like approach. Unfortunately, something's not working and I can't find why.

Ideas?

@nulltoken
Copy link
Member Author

/cc @carlosmn @dahlbyk @ammeep

@nulltoken
Copy link
Member Author

Rebound of #946

@nulltoken nulltoken mentioned this pull request Feb 10, 2015
@nulltoken
Copy link
Member Author

Hmmm.... The Filter* tests now pass now locally but the memory is messed up...

@nulltoken
Copy link
Member Author

@Therzok Tests are failing on AppVeyor. Looks like a memory issue. They pass when ran from Visual Studio, but launching build.libgit2sharp.cmd crashes the test runner. An idea?

@nulltoken
Copy link
Member Author

w00t! The test runner is safe now (courtesy of @ammeep the CrashTamer™).

@nulltoken
Copy link
Member Author

One thing I'm going to add to this is some kind of smoother buffer growing algorithm (eg. if we're at 90% of asize, grow the buffer by 50%). Should have something working tomorrow

@nulltoken
Copy link
Member Author

@dahlbyk @ammeep Ready for review

[Fact]
public void FilterStreamsAreCoherent()
{

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 the new line

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💀'd it

@ammeep
Copy link
Member

ammeep commented Feb 11, 2015

These changes look great. I'll pull this down and give it a test with a custom filter implementation of my own.

@nulltoken
Copy link
Member Author

/cc @ethomson

@ammeep
Copy link
Member

ammeep commented Feb 11, 2015

I've taken this for a spin locally and it works just perfectly ✨


public override void Write(byte[] buffer, int offset, int count)
{
AutoGrowBuffer(count);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? git_buf knows how to grow itself (that is much of the point for it existing).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cmn @ammeep How about preallocating 4kb?

@cmn Some local tests show that this (basic) auto grow mechanism leads to fewer reallocs when compared to bare git_buf_put() usage.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allocating a page would be better yes (assuming you do mean 4kB). The difference in allocations is surprising, since you're also growing by 1.5 and the size is ensured anyhow. The one difference seems to be that you assume there is going to be a next request and preallocate for it. How large is the difference in reallocs? What's the difference in memory consumption?

@nulltoken nulltoken mentioned this pull request Feb 12, 2015
5 tasks
ammeep pushed a commit that referenced this pull request Feb 13, 2015
@ammeep ammeep merged commit 21a6381 into dahlbyk/register-custom-filters Feb 13, 2015
@ammeep ammeep deleted the ntk/filters_stream_rebound branch February 13, 2015 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants