I have been running some test scripts on SPLUS 3.4 and SPLUS 5.1 on a UNIX SUN
system. I ran the same scripts, but the processing times for 'sapply' were much
longer on the later 5.1 version (1.18 sec on 3.4, vs. 53.7 sec on 5.1). Is this
going to be improved in the 6.0 version of SPLUS?
Here is the 3.4 version of the script:
S-PLUS : Copyright (c) 1988, 1996 MathSoft, Inc.
S : Copyright AT&T.
Version 3.4 Release 1 for Sun SPARC, SunOS 5.3 : 1996
> a.1_read.table('tempxx')
> str(a.1)
`data.frame': 11947 obs. of 6 variables:
$ V1: num 2.23e+08 2.23e+08 2.23e+08 2.23e+08 2.23e+08 ...
$ V2: class Factor ; 137 levels: AcsEqpChangeU,AcsEqpEqpU: 137 123 131 135 122
125 137 123 131 135 ...
$ V3: num 95291241 95291648 95292370 95293231 95294016 ...
$ V4: num 95291266 95291733 95292425 95293401 95294258 ...
$ V5: num 95291241 95291241 95291241 95291241 95291241 ...
$ V6: num 95295428 95295428 95295428 95295428 95295428 ...
> unix.time(a.2 <- sapply(split(seq(along=a.1$V1),a.1$V1),function(x,data){
range(data$V3[x],data$V4[x])},data=a.1))
#
# processing time (1.18 seconds)
#
[1] 1.18 0.04 1.00 0.00 0.00
> str(a.2)
Array [1:2, 1:3624] 2.27e+06 1.25e+08 2.89e+06 7.89e+06 4.05e+06 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:3624] '0' '213523239' '214832258' '214832261' '214832262' ...
> a.2[,1:10]
0 213523239 214832258 214832261 214832262 214832265 214832266
[1,] 2272005 2886983 4053772 97764719 97781919 97886481 97898252
[2,] 125063705 7888528 94045768 97765905 97806234 97888938 97904909
214832276 214832277 214832281
[1,] 98079423 98110589 98241368
[2,] 98106012 98112765 98242305
> q()
Here is the 5.1 version of the same script. The output was the same (thank
goodness):
S-PLUS : Copyright (c) 1988, 1999 MathSoft, Inc.
S : Copyright Lucent Technologies, Inc.
Version 5.1 Release 1 for Sun SPARC, SunOS 5.5 : 1999
> a.1 <- read.table('../tempxx')
> str(a.1)
`data.frame': 11947 obs. of 6 variables:
$ V1: num 223069800 223069800 223069800 223069800 223069800 ...
$ V2: class Factor ; 137 levels: AcsEqpChangeU,AcsEqpEqpU: 137 123 131 135 122
125 137 123 131 135 ...
..- attr(*, "class")= chr 'factor'
$ V3: num 95291241 95291648 95292370 95293231 95294016 ...
$ V4: num 95291266 95291733 95292425 95293401 95294258 ...
$ V5: num 95291241 95291241 95291241 95291241 95291241 ...
$ V6: num 95295428 95295428 95295428 95295428 95295428 ...
> unix.time(a.2 <- sapply(split(seq(along=a.1$V1),a.1$V1),function(x,data){
range(data$V3[x],data$V4[x])},data=a.1))
#
# processing time (53.7 seconds)
#
[1] 53.74 0.11 54.00 0.00 0.00
> str(a.2)
Array [1:2, 1:3624] 2272005 125063705 2886983 7888528 4053772 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:3624] '0' '213523239' '214832258' '214832261' '214832262'
'214832265' ...
> a.2[,1:10]
0 213523239 214832258 214832261 214832262 214832265 214832266 214832276
214832277
2272005 2886983 4053772 97764719 97781919 97886481 97898252 98079423
98110589
125063705 7888528 94045768 97765905 97806234 97888938 97904909 98106012
98112765
214832281
98241368
98242305
> q()
--
NOTICE: The information contained in this electronic mail transmission is
intended by Convergys Corporation for the use of the named individual or entity
to which it is directed and may contain information that is privileged or
otherwise confidential. If you have received this electronic mail transmission
in error, please delete it from your system without copying or forwarding it,
and notify the sender of the error by reply email or by telephone (collect), so
that the sender's address records can be corrected.
|