From: "Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Specialized dictionaries
Date: Mon, 5 Nov 2001 11:49:37 +0000 (UTC) [thread overview]
Message-ID: <slrn9ucv6h.73g.qrczak@qrnik.zagroda> (raw)
In-Reply-To: <9s5pe7$5k6$1@qrnik.zagroda>
Mon, 5 Nov 2001 11:19:56 +0100, Xavier Leroy <xavier.leroy@inria.fr> pisze:
> No, no need to copy anything, just unleash the power of functors!
>
> module IntHashtbl = Hashtbl.make(struct type t = int
> let equal = (==)
> let hash x = x land 0x3FFFFFFF
> end)
Ok, I tried:
Implementation | Test1 | Test2
---------------------------------+-------+-------
Hashtbl.t | 7.40s | 6.45s
Hashtbl.Make(...) | 3.62s | 5.35s
hashtbl.ml specialized for ints | 2.37s | 5.00s
Test1 is a small program which does nothing but dictionary lookups.
Test2 is a real program where I use dictionaries.
It happenens that
let equal = (==)
let equal (x : int) (y : int) = x = y
are fast, where
let equal x y = x = y
(* module constrained by Hashtbl.HashedType with type t = int *)
let equal : int -> int -> bool = (=)
are slow. The compiler doesn't insert the specialized equality version
if it's not immediately applied, or if its type is constrained only
by module signature.
I'm going to use the functorial version: 7% loss of performance
wrt. the specialized version is acceptable.
--
__("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
\__/
^^
QRCZAK
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
next prev parent reply other threads:[~2001-11-05 11:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-05 10:06 Marcin 'Qrczak' Kowalczyk
2001-11-05 10:19 ` Xavier Leroy
2001-11-05 10:32 ` Jean-Christophe Filliatre
2001-11-05 17:36 ` Florian Hars
2001-11-05 17:54 ` Sven
[not found] ` <9s6j7c$i6r$1@qrnik.zagroda>
2001-11-05 18:18 ` Marcin 'Qrczak' Kowalczyk
2001-11-05 18:24 ` Nicolas George
[not found] ` <9s6m53$k16$1@qrnik.zagroda>
2001-11-05 20:56 ` Marcin 'Qrczak' Kowalczyk
2001-11-06 6:53 ` Sven
2001-11-06 0:35 ` Marcin 'Qrczak' Kowalczyk
[not found] ` <9s5pe7$5k6$1@qrnik.zagroda>
2001-11-05 11:49 ` Marcin 'Qrczak' Kowalczyk [this message]
2001-11-05 23:40 ` Julian Assange
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=slrn9ucv6h.73g.qrczak@qrnik.zagroda \
--to=qrczak@knm.org.pl \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox