Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slight performance boost for SingleMap case #3

Merged
merged 1 commit into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.tcl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package require tin 1.0
tin import assert from tin
tin import tcltest
set version 0.2
set version 0.2.1
set vutil_version 1.1
set config [dict create VERSION $version VUTIL_VERSION $vutil_version]
tin bake src build $config
Expand Down
Binary file modified doc/ndlist.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion doc/template/version.tex
Original file line number Diff line number Diff line change
@@ -1 +1 @@
\newcommand{\version}{0.2}
\newcommand{\version}{0.2.1}
2 changes: 1 addition & 1 deletion install.tcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package require tin 1.0
tin depend vutil 1.1
set dir [tin mkdir -force ndlist 0.2]
set dir [tin mkdir -force ndlist 0.2.1]
file copy pkgIndex.tcl ndlist.tcl README.md LICENSE $dir
9 changes: 5 additions & 4 deletions ndlist.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -1778,10 +1778,11 @@ proc ::ndlist::SingleMap {ndims ndlist body {axis 0}} {
set nmap_i($axis) -1
if {$ndims == 1} {
# Base case
set result [uplevel 1 [list lmap x $ndlist "
upvar 1 x x
set result [lmap x $ndlist {
incr nmap_i($axis)
uplevel 1 [list $body]
"]]
uplevel 2 $body
}]
# Check for break
if {$nmap_i($axis) != [llength $ndlist] - 1} {
set nmap_break 1
Expand Down Expand Up @@ -1949,4 +1950,4 @@ proc ::ndlist::range {args} {
################################################################################

# Finally, provide the package
package provide ndlist 0.2
package provide ndlist 0.2.1
2 changes: 1 addition & 1 deletion pkgIndex.tcl
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
if {![package vsatisfies [package provide Tcl] 8.6]} {return}
package ifneeded ndlist 0.2 [list source [file join $dir ndlist.tcl]]
package ifneeded ndlist 0.2.1 [list source [file join $dir ndlist.tcl]]
7 changes: 4 additions & 3 deletions src/ndlist.tin
Original file line number Diff line number Diff line change
Expand Up @@ -1778,10 +1778,11 @@ proc ::ndlist::SingleMap {ndims ndlist body {axis 0}} {
set nmap_i($axis) -1
if {$ndims == 1} {
# Base case
set result [uplevel 1 [list lmap x $ndlist "
upvar 1 x x
set result [lmap x $ndlist {
incr nmap_i($axis)
uplevel 1 [list $body]
"]]
uplevel 2 $body
}]
# Check for break
if {$nmap_i($axis) != [llength $ndlist] - 1} {
set nmap_break 1
Expand Down