| Anonymous | Login | Signup for a new account | 2013-05-21 15:42 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | |||||||
| 0005290 | OCaml | OCaml general | public | 2011-06-17 01:00 | 2011-07-23 12:25 | |||||||
| Reporter | Boris Yakobowski | |||||||||||
| Assigned To | xleroy | |||||||||||
| Priority | normal | Severity | major | Reproducibility | always | |||||||
| Status | resolved | Resolution | open | |||||||||
| Platform | OS | OS Version | ||||||||||
| Product Version | 3.12.0 | |||||||||||
| Target Version | Fixed in Version | |||||||||||
| Summary | 0005290: Hashing of custom blocks | |||||||||||
| Description | Hashtbl.hash returns 0 on custom blocks, at least those of the standard library (verified on bigints, channels, and by a cursory grep). This is consistent with its documentation "associates a positive integer to any value of any type". However, it is IMHO a very poor choice, as this will always silently lead to abysmal performances when this function is used on such values. It would be more logical to have this function fail, just as polymorphic equality and comparison. Since Hashtbl are about to undergo a massive rewrite in 3.13, please consider deprecating the old behavior and have the function fail. (For the record, this really bit us. After some reorganization, we started using the polymorphic hashing function, and Frama-C performances dropped terribly. It took us one afternoon to track the culprit.) (Also, providing a good hash function for bigints/nats, one bound in the custom block, would be great. For example, keep only the 2^(n-1) lowest or highest bits. This cannot be done efficiently in pure Caml.) | |||||||||||
| Tags | No tags attached. | |||||||||||
| Attached Files | ||||||||||||
Notes |
|
|
(0006015) Boris Yakobowski (reporter) 2011-06-17 11:55 |
A precision: the custom blocks are on Nats, not on bigints. |
|
(0006018) xleroy (administrator) 2011-06-20 19:03 |
*Some* standard library types have proper hash functions, e.g. Int32.t, Nativeint.t and Int64.t, but you are correct that channels and nats don't while they should. I put that on my to do list. |
|
(0006058) xleroy (administrator) 2011-07-23 12:25 |
Tentative fix in SVN trunk, will go in 3.13. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2011-06-17 01:00 | Boris Yakobowski | New Issue | |
| 2011-06-17 10:55 | Pascal Cuoq | Note Added: 0006014 | |
| 2011-06-17 10:56 | Pascal Cuoq | Note Deleted: 0006014 | |
| 2011-06-17 11:55 | Boris Yakobowski | Note Added: 0006015 | |
| 2011-06-20 19:03 | xleroy | Note Added: 0006018 | |
| 2011-06-20 19:03 | xleroy | Status | new => assigned |
| 2011-06-20 19:04 | xleroy | Assigned To | => xleroy |
| 2011-07-23 12:25 | xleroy | Note Added: 0006058 | |
| 2011-07-23 12:25 | xleroy | Status | assigned => resolved |
| Copyright © 2000 - 2011 MantisBT Group |