[Rd] Small performance bug in [.Date

2017-11-20 Thread Hadley Wickham
Hi all,

I think there's an unnecessary line in [.Date which has a considerable
impact on performance when subsetting large dates:

x <- Sys.Date() + 1:1e6

microbenchmark::microbenchmark(x[1])
#> Unit: microseconds
#>  expr min   lq mean   median   uq  max neval
#>  x[1] 920.651 1039.346 3624.833 2294.404 3786.881 41176.38   100

`[.Date` <- function(x, ..., drop = TRUE) {
cl <- oldClass(x)
# class(x) <- NULL
val <- NextMethod("[")
class(val) <- cl
val
}
microbenchmark::microbenchmark(x[1])
#> Unit: microseconds
#>  expr   min lq mean medianuq  max neval
#>  x[1] 2.738 3.0225 28.40893  3.269 3.513 2470.068   100

Setting the class of x to NULL is problematic because it forces a
copy, and I'm pretty sure it's unnecessary as NextMethod() does not
consult the class of x, but instead uses .Class.

Hadley

-- 
http://hadley.nz

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] package check fail on Windows-release only?

2017-11-20 Thread Paul Johnson
I mistakenly left a write in "/tmp" in the rockchalk package (version
1.8.109) that I uploaded last Friday. Kurt H wrote and asked me to fix
today.

While uploading a new one, I became aware of a problem I had not seen.
The version I uploaded last Friday, 1.8.109, has OK status on all
platforms except r-release-windows-ix86+x86_64. I get OK on
oldrel-windows and also on devel-windows.

https://cran.r-project.org/web/checks/check_results_rockchalk.html

Can you please advise me on what to do? I don't understand, well,
anything about this :(

The error says:

* installing *source* package 'rockchalk' ...
** package 'rockchalk' successfully unpacked and MD5 sums checked
** R
** data
** inst
** preparing package for lazy loading
Warning: S3 methods 'print.sparseSummary', 'print.diagSummary',
'c.abIndex', 'c.sparseVector', 'as.array.Matrix',
'as.array.sparseVector', 'as.matrix.Matrix', 'as.matrix.sparseVector',
'as.vector.Matrix', 'as.vector.sparseVector' were declared in
NAMESPACE but not found
Error in namespaceExport(ns, exports) :
  undefined exports: %&%, Cholesky, .SuiteSparse_version, Diagonal,
.symDiagonal, .sparseDiagonal, .trDiagonal, Hilbert, KhatriRao,
Matrix, MatrixClass, spMatrix, sparseMatrix, rsparsematrix, Schur,
abIseq, abIseq1, rep2abI, band, bandSparse, bdiag, .bdiag,
c.sparseVector, condest, onenormest, .asmatrix, .dsy2mat, .dsy2dsp,
.dxC2mat, .T2Cmat, ..2dge, .dense2sy, .C2nC, .nC2d, .nC2l, .diag.dsC,
.solve.dgC.chol, .solve.dgC.qr, .solve.dgC.lu, diagN2U, diagU2N,
.diagU2N, .diag2tT, .diag2sT, .diag2mat, drop0, expand, expm, facmul,
fac2sparse, fac2Sparse, forceSymmetric, T2graph, graph2T,
anyDuplicatedT, uniqTsparse, isTriangular, isDiagonal, isLDL,
is.null.DN, invPerm, lu, nearPD, nnzero, formatSpMatrix,
formatSparseM, .formatSparseSimple, printSpMatrix, printSpMatrix2,
qrR, rankMatrix, readHB, readMM, sparse.model.matrix, sparseVector,
symmpart, skewpart, tril, triu, updown, pack, unpack,
.updateCHMfactor, .validateCsparse, writeMM, cBind, rBind
ERROR: lazy loading failed for package 'rockchalk'
* removing 'd:/Rcompile/CRANpkg/lib/3.4/rockchalk'
* restoring previous 'd:/Rcompile/CRANpkg/lib/3.4/rockchalk'


-- 
Paul E. Johnson   http://pj.freefaculty.org
Director, Center for Research Methods and Data Analysis http://crmda.ku.edu

To write to me directly, please address me at pauljohn at ku.edu.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel