Comments (4)
No, that's not worth it:
library(fixest)
library(RcppEigen)
n = 1e6
base = data.frame(x1 = rnorm(n), x2 = rnorm(n), x3 = rnorm(n))
base$y = with(base, x1 + x2 + x3 + rnorm(n, sd = 20))
system.time(a <- fastLm(y ~ x1 + x2 + x3, base))
#> user system elapsed
#> 0.42 0.03 0.45
system.time(b <- feols(y ~ x.[1:3], base))
#> user system elapsed
#> 0.03 0.00 0.03
rbind(coef(a), coef(b))
#> (Intercept) x1 x2 x3
#> [1,] 0.02777233 1.026369 1.009945 0.9609391
#> [2,] 0.02777233 1.026369 1.009945 0.9609391
Please Wayne, do insert a use case next time!
For the record, I have tested the idea of using Eigen for linear algebra a long time ago.
The problem is that Eigen is single threaded, such that while it is clearly an improvement for single threaded mode, its benefit wanes quickly when compared to my (rather simple) multi-threaded code.
Hence implementing it wasn't an unconditional win (and it would add a huge dependency) so I didn't use it in the end.
from fixest.
Hi @lrberge (maybe I am misunderstanding) - RcppEigen is in fact multithreaded, e.g. matrix multiplication can easily be run via multiple threads, with sometimes very nice performance gains - a while back I have collected some benchmarks here. Though I have no idea if this would help speed up ´fixest´. For fwildclusterboot
, where I have to right-multiply with a potentially very large bootstrap weights matrix (G x B; dim of clusters x bootstrap iterations), it definitely made a difference. :)
from fixest.
Eigen has been able to use multiple threads via OpenMP for many years. https://eigen.tuxfamily.org/dox/TopicMultiThreading.html
The function fastLm does not use multiple threads but can when the OpenMP compiler option is enabled.
RcppCore/RcppEigen#129
from fixest.
Not exactly what I wrote in RcppCore/RcppEigen#129. In any event, if someone wants a change, it would seem that starting with some well-chosen benchmark examples would be a good start, as opposed to a two-line issue without support or reasoning. My bet is that a linear model is so quick already that going the multiple threads is unlikely to be much of a game changer. But as always, actual empirics could change my mind.
from fixest.
Related Issues (20)
- fixest 0.12 has broken etable and sunab HOT 6
- fixest 0.12.0: Summary function not working HOT 6
- FR: Use Satterthwaite approximation in Wald test
- 🔥 Major bug introduced in fixest 0.12.0 for R versions 4.1.0 to 4.1.2 -- SOLVED HOT 3
- Different Outputs from print(model) - print(model$coeftable) HOT 2
- Suggestion: make `fixef.rm = 'both'` the default
- I got different results from plm and fixest when estimating a 2sls panel model HOT 1
- `l()` error with named parameter HOT 1
- fixest::d() not working even though fixest::panel was called HOT 1
- Allow print method for etable_df to occupy entire width
- Clarification on Using ref.c in sunab Function for Reference Cohorts
- Error in `feols` with 'subset' and 'fixef' parameters
- Bug in `esttex()` when p-value < 2.2e-16 HOT 1
- Latex issue in `esttex()` with "F-test (1st stage)" fit statistics and snake case variable HOT 3
- Clarifying varying slopes HOT 2
- fepois() does not fully replicate ppmlhdfe in Stata HOT 4
- Suggestion to Update Citation File HOT 1
- feglm(family='poisson') seems to hang in cpp_demean() but femlm(family='poisson') does not? HOT 2
- Turn off standard error calculation HOT 1
- Issue with `Inf` in iplot HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fixest.