Permalink
Browse files

Merge commit '649b2b64aaf92bc8f974fce2ea15086762707f90' as 'vendor/un…

…derscore-tcl'
  • Loading branch information...
2 parents f24f17a + 649b2b6 commit 87965f0e290db8d3f8ef4fb9c5dcd188664196c2 @arthurschreiber committed Nov 18, 2012
@@ -0,0 +1,34 @@
+set auto_path [concat [file join [file dirname [info script]] ".."] $auto_path]
+
+package require underscore
+
+set numbers [list]
+for {set i 0} {$i < 100} { incr i } { lappend numbers $i }
+
+puts "foreach with empty body"
+puts [time {
+ foreach num $numbers {
+ # Do nothing...
+ }
+} 1000]
+
+puts "_::each with empty body"
+puts [time {
+ _::each $numbers {{num} {
+ # Do nothing...
+ }}
+} 1000]
+
+puts "foreach with expression"
+puts [time {
+ foreach num $numbers {
+ expr { $num * $num }
+ }
+} 1000]
+
+puts "_::each with expression"
+puts [time {
+ _::each $numbers {{num} {
+ expr { $num * $num }
+ }}
+} 1000]
@@ -0,0 +1,21 @@
+set auto_path [concat [file join [file dirname [info script]] ".."] $auto_path]
+
+package require underscore
+
+set numbers [list]
+for {set i 0} {$i < 100} { incr i } { lappend numbers $i }
+
+puts "mapping using foreach with expression"
+puts [time {
+ set result [list]
+ foreach num $numbers {
+ lappend result [expr { $num * $num }]
+ }
+} 1000]
+
+puts "_::map with expression"
+puts [time {
+ _::map $numbers {{num} {
+ expr { $num * $num }
+ }}
+} 1000]
@@ -0,0 +1 @@
+package ifneeded underscore 0.1 "source $dir/underscore.tcl"
Oops, something went wrong.

0 comments on commit 87965f0

Please sign in to comment.