caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] troubling results from profiling: compare_val
@ 2003-02-26 17:03 David Monniaux
  2003-02-26 18:54 ` Mattias Waldau
  0 siblings, 1 reply; 3+ messages in thread
From: David Monniaux @ 2003-02-26 17:03 UTC (permalink / raw)
  To: Liste CAML

Dear Caml developers,

I profiled some mixed C/Caml program and saw that it spends 11% of its
time in compare_val(), as well as an important total time in compare().

Our code uses some maps on strings and many comparisons on int64's.

On the one hand, I tend to think that invoking a function that begins by
examining the concrete types of the data structures it is passed to when
those types are known at compilation time is a bit inefficient. On the
other hand, maybe the slight overhead is drowned in the whole time
necessary to make a native call and do the necessary comparisons in the
native code.

Is there a way to get more precise information than the one supplied by
ocamlprof -p / gprof on Linux/x86? How about a library using the TSC? A
Caml interface to Papi?

Regards,

David Monniaux            http://www.di.ens.fr/~monniaux
Laboratoire d'informatique de l'École Normale Supérieure,
Paris, France

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [Caml-list] troubling results from profiling: compare_val
  2003-02-26 17:03 [Caml-list] troubling results from profiling: compare_val David Monniaux
@ 2003-02-26 18:54 ` Mattias Waldau
  2003-02-26 21:39   ` Alain.Frisch
  0 siblings, 1 reply; 3+ messages in thread
From: Mattias Waldau @ 2003-02-26 18:54 UTC (permalink / raw)
  To: 'David Monniaux', 'Liste CAML'

If you know that you have numbers, in many cases you can use
- (minus) as comparation operator. That speeds things up.

> Our code uses some maps on strings and many comparisons on int64's.
> 

/mattias

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [Caml-list] troubling results from profiling: compare_val
  2003-02-26 18:54 ` Mattias Waldau
@ 2003-02-26 21:39   ` Alain.Frisch
  0 siblings, 0 replies; 3+ messages in thread
From: Alain.Frisch @ 2003-02-26 21:39 UTC (permalink / raw)
  To: Mattias Waldau; +Cc: 'David Monniaux', 'Liste CAML'

On Wed, 26 Feb 2003, Mattias Waldau wrote:

> If you know that you have numbers, in many cases you can use
> - (minus) as comparation operator. That speeds things up.

Beware of the modulo semantics of the arithmetic operator (-) !

# List.sort (fun x y -> x - y) [min_int;max_int];;
- : int list = [1073741823; -1073741824]

-- Alain
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-02-27 15:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-26 17:03 [Caml-list] troubling results from profiling: compare_val David Monniaux
2003-02-26 18:54 ` Mattias Waldau
2003-02-26 21:39   ` Alain.Frisch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).