Commit 2358fd0
committed
Optimize d3_dsv.
Replace regular expression search with a simple if-else.
Replace a for-loop with a new Function to convert rows to objects, such that
each row is defined in a single step as an object literal rather than lazily
defining properties on a blank object. Note that parseRows can still be
substantially faster for large files provided you convert strings to smaller
types (e.g., numbers or booleans); greedy type-conversion reduces peak memory
usage and accelerates garbage collection.1 parent 2356206 commit 2358fd0
3 files changed
Lines changed: 50 additions & 58 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1844 | 1844 | | |
1845 | 1845 | | |
1846 | 1846 | | |
1847 | | - | |
| 1847 | + | |
1848 | 1848 | | |
1849 | | - | |
1850 | | - | |
1851 | | - | |
1852 | | - | |
1853 | | - | |
1854 | | - | |
1855 | | - | |
1856 | | - | |
1857 | | - | |
1858 | | - | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
1859 | 1855 | | |
1860 | 1856 | | |
1861 | 1857 | | |
1862 | 1858 | | |
1863 | | - | |
1864 | | - | |
1865 | | - | |
1866 | | - | |
1867 | | - | |
1868 | | - | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
1869 | 1862 | | |
1870 | 1863 | | |
1871 | | - | |
| 1864 | + | |
1872 | 1865 | | |
1873 | 1866 | | |
1874 | | - | |
| 1867 | + | |
1875 | 1868 | | |
1876 | 1869 | | |
1877 | | - | |
| 1870 | + | |
1878 | 1871 | | |
1879 | 1872 | | |
1880 | 1873 | | |
1881 | | - | |
| 1874 | + | |
1882 | 1875 | | |
1883 | 1876 | | |
1884 | 1877 | | |
1885 | 1878 | | |
1886 | 1879 | | |
1887 | | - | |
1888 | | - | |
1889 | | - | |
1890 | | - | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
1891 | 1887 | | |
1892 | | - | |
1893 | 1888 | | |
1894 | 1889 | | |
1895 | | - | |
1896 | | - | |
| 1890 | + | |
1897 | 1891 | | |
1898 | 1892 | | |
1899 | 1893 | | |
| |||
0 commit comments