[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Turning `scm_is_pair ()' into a macro
From: |
Ludovic Courtès |
Subject: |
[PATCH] Turning `scm_is_pair ()' into a macro |
Date: |
Wed, 14 Dec 2005 15:46:01 +0100 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) |
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 <address@hidden>
* 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);
- [PATCH] Turning `scm_is_pair ()' into a macro,
Ludovic Courtès <=