Bug 16467 - Very poor performance when converting a unnamed list to a data.frame
Summary: Very poor performance when converting a unnamed list to a data.frame
Status: CLOSED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: Language (show other bugs)
Version: R 3.1.3
Hardware: x86_64/x64/amd64 (64-bit) Windows 64-bit
: P5 normal
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2015-07-07 02:04 UTC by dion.maxime
Modified: 2015-12-14 13:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dion.maxime 2015-07-07 02:04:26 UTC
In the data.frame function (around line 74):

   tmpname <- deparse(object[[i]])[1L]

should be 

    tmpname <- deparse(object[[i]], nlines = 1)[1L]

Otherwise the performance is very poor when converting an unnamed list to a data.frame:

> x <- rep(1, 1000000)
> system.time(df <- data.frame(list(x)))
   user  system elapsed 
   1.56    0.00    1.56 

Compare to a named list:

> system.time(df <- data.frame(list(x = x)))
   user  system elapsed 
      0       0       0
Comment 1 Brian Ripley 2015-08-12 11:15:14 UTC
This is more 'performance can be very poor': it is not for typical uses.

Changed for R-devel and, soon, R 3.2.2 patched.