Re: Optimization of "switch" stmt in C

Daniel Villeneuve <danielv@crt.umontreal.ca>
27 Sep 1999 11:24:21 -0400

          From comp.compilers

Related articles
Optimization of "switch" stmt in C mayur_naik@my-deja.com (1999-09-20)
Re: Optimization of "switch" stmt in C ast@halcyon.com (Andrew Tucker) (1999-09-20)
Re: Optimization of "switch" stmt in C jejones@microware.com (James Jones) (1999-09-20)
Re: Optimization of "switch" stmt in C jcownie@etnus.com (James Cownie) (1999-09-24)
Re: Optimization of "switch" stmt in C ger@informatik.uni-nospam-bremen.de (George Russell) (1999-09-24)
Re: Optimization of "switch" stmt in C vmakarov@cygnus.com (Vladimir Makarov) (1999-09-24)
Re: Optimization of "switch" stmt in C danielv@crt.umontreal.ca (Daniel Villeneuve) (1999-09-27)
Re: Optimization of "switch" stmt in C drh@microsoft.com (Dave Hanson) (1999-09-28)
Re: Optimization of "switch" stmt in C cmilner@virginia.edu (Christopher W. Milner) (1999-10-01)
| List of all articles for this month |
From: Daniel Villeneuve <danielv@crt.umontreal.ca>
Newsgroups: comp.compilers
Date: 27 Sep 1999 11:24:21 -0400
Organization: Compilers Central
References: 99-09-081 99-09-096
Keywords: code

Vladimir Makarov writes:
  ] mayur_naik@my-deja.com wrote:
  ]
  ] > GNU CC generates a switch table, a binary search, or a linear
  ] > search for a switch stmt. I want to understand the exact algorithm.
  ] > Any help is greatly appreciated.


  ] Some combination binary search and jump table would be helpful to
  ] improve the code.
  ]
  ] Actually, there are some works in improving GNU CC switch generation.


I have not seen any references to a perfect hashing strategy.
Has this ever been considered, in theory or in practice?
--
Daniel
[Perfect hashing is highly overrated. Computing a perfect hash is really
slow, and it rarely ends up being as fast as a normal imperfect hash even
with holes and collsions in the hash table. It was discussed a long time
ago in comp.compilers in the context of recognizing keywords. -John]



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.