[Issue 2331] Enum hashes many times slower than normal hashes

2015-06-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2331

Andrei Alexandrescu and...@erdani.com changed:

   What|Removed |Added

Version|unspecified |D2

--


[Issue 2331] Enum hashes many times slower than normal hashes

2010-09-22 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2331


Mitch Hayenga mitch.haye...@gmail.com changed:

   What|Removed |Added

 CC||mitch.haye...@gmail.com


--- Comment #5 from Mitch Hayenga mitch.haye...@gmail.com 2010-09-22 10:22:20 
PDT ---
I recently hit this performance issue myself while trying to use a lookup
table, rather than branching on logic for a function.  It can be avoided by
declaring the field as invariant, but I had originally used Enum as thats one
of the ways suggested by TDPL for doing CTFE.


pseudocode:

bool[256] generate_lookup_table(); // function declaration

// Performance = terrible here
enum lookup_as_enum = generate_lookup_table();

// Performance = great here
invariant lookup_as_enum = generate_lookup_table();

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 2331] Enum hashes many times slower than normal hashes

2010-09-22 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2331


nfx...@gmail.com changed:

   What|Removed |Added

 CC||nfx...@gmail.com


--- Comment #6 from nfx...@gmail.com 2010-09-22 10:51:38 PDT ---
(In reply to comment #1)
 What's happening is that the static this() constructor builds the hash table
 once. The enum version builds it every time it is used, as the enum name is
 replaced with its initializer.

That's quite hilarious. There are now half a dozen of bugs related to dmd being
stupid with static data construction. E.g. see bug 4397, bug 2526, bug 2356,
bug 4881. They possibly are all caused by the same underlying issue. Walter,
don't you think your users are finally annoyed enough so that you could look
into fixing it?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 2331] Enum hashes many times slower than normal hashes

2010-09-22 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2331


bearophile_h...@eml.cc changed:

   What|Removed |Added

 CC||bearophile_h...@eml.cc


--- Comment #7 from bearophile_h...@eml.cc 2010-09-22 11:40:48 PDT ---
(In reply to comment #6)
 Walter, don't you think your users are finally annoyed enough
 so that you could look into fixing it?

Be more gentle, please.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---