unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] Turning `scm_is_pair ()' into a macro
@ 2005-12-14 14:46 Ludovic Courtès
  2005-12-14 20:57 ` Kevin Ryde
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Ludovic Courtès @ 2005-12-14 14:46 UTC (permalink / raw)


Hi,

I believe it *really* makes sense to turn `scm_is_pair ()' into a macro.

Before:

   %   cumulative   self              self     total           
  time   seconds   seconds    calls   s/call   s/call  name    
  14.74     17.99    17.99 25918076     0.00     0.00  scm_is_pair
  13.72     34.73    16.74   104054     0.00     0.00  deval
  13.27     50.92    16.19    71854     0.00     0.00  scm_i_sweep_card
  13.20     67.03    16.11  3359204     0.00     0.00  scm_gc_mark_dependencies
  ...

After:

   %   cumulative   self              self     total           
  time   seconds   seconds    calls   s/call   s/call  name    
  16.11     17.92    17.92   104054     0.00     0.00  deval
  15.69     35.37    17.45    71854     0.00     0.00  scm_i_sweep_card
  14.77     51.80    16.43  3360490     0.00     0.00  scm_gc_mark_dependencies
  ...

Thanks,
Ludovic.

PS: You might have noticed that GC takes more than twice as long as
    evaluation on this example.  This is the subject of fascinating
    ongoing work.  ;-)


2005-12-14  Ludovic Courtès  <ludovic.courtes@laas.fr>

	* pairs.h (scm_is_pair): Made a macro rather than a function.

	* pairs.c (scm_is_pair): Only defined for binary compatibility.


--- orig/libguile/pairs.c
+++ mod/libguile/pairs.c
@@ -78,11 +78,6 @@
 }
 #undef FUNC_NAME
 
-int
-scm_is_pair (SCM x)
-{
-  return SCM_I_CONSP (x);
-}
 
 SCM
 scm_car (SCM pair)
@@ -203,6 +198,14 @@
 #include "libguile/pairs.x"
 }
 
+/* FIXME: This is temporarily kept for binary compatilibity and should
+   eventually be removed.  */
+#undef scm_is_pair
+int
+scm_is_pair (SCM x)
+{
+  return SCM_I_CONSP (x);
+}
 
 /*
   Local Variables:


--- orig/libguile/pairs.h
+++ mod/libguile/pairs.h
@@ -78,7 +78,7 @@
 SCM_API void scm_error_pair_access (SCM);
 #endif
 
-SCM_API int scm_is_pair (SCM x);
+#define scm_is_pair(__obj)  (SCM_I_CONSP (__obj))
 
 SCM_API SCM scm_cons (SCM x, SCM y);
 SCM_API SCM scm_cons2 (SCM w, SCM x, SCM y);



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


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

end of thread, other threads:[~2006-02-05 19:10 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-14 14:46 [PATCH] Turning `scm_is_pair ()' into a macro Ludovic Courtès
2005-12-14 20:57 ` Kevin Ryde
2005-12-14 23:00 ` Han-Wen Nienhuys
2005-12-14 23:19 ` Marius Vollmer
2005-12-15  9:39   ` Ludovic Courtès
2005-12-16  0:08     ` Han-Wen Nienhuys
2005-12-16 10:01       ` Ludovic Courtès
2006-01-24  8:37         ` [PATCH] Inlining `scm_is_pair ()' Ludovic Courtès
2006-01-24 20:12           ` Kevin Ryde
2006-01-25  9:21             ` Ludovic Courtès
2006-01-26 23:13               ` Kevin Ryde
2006-01-27  9:13                 ` Ludovic Courtès
2006-01-28 22:07           ` Marius Vollmer
2006-01-30  9:06             ` Ludovic Courtès
2006-02-03 23:49             ` Kevin Ryde
2006-02-05 19:10               ` Marius Vollmer
2005-12-16  0:41   ` [PATCH] Turning `scm_is_pair ()' into a macro Kevin Ryde
2005-12-16 20:01     ` Marius Vollmer

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 read-only IMAP folder(s) and NNTP newsgroup(s).