lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simplify and speed up uniquify (issue 583390043 by address@hidden)


From: hanwenn
Subject: Re: Simplify and speed up uniquify (issue 583390043 by address@hidden)
Date: Sat, 25 Jan 2020 04:20:36 -0800

On 2020/01/24 15:50:22, Dan Eble wrote:
> On 2020/01/24 15:17:02, dak wrote:
> > On 2020/01/24 14:11:59, Dan Eble wrote:
> > > On 2020/01/24 14:06:22, hanwenn wrote:
> > > > If the allocation cost becomes problematic, we can use another
hashmap
> > > instead.
> > > 
> > > "We" could profile it and know before pushing whether it is worth
it.
> > 
> > I don't think that this is really performance-critical.
> 
> I accept your informed intuition, but I also have more suggestions.
> 
> Don't assume the hash function is perfect: create the table with more
buckets,
> say 2*size.
> 
> Instead of calling find() then insert(), just call insert() and check
whether it
> worked, something like this (untested):
> 
>     if (seen.insert(grobs[i]).second)
>       grobs[j++] = grobs[i];
> 
> https://en.cppreference.com/w/cpp/container/unordered_set/insert

Done.

https://codereview.appspot.com/583390043/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]