An approach for cheap small tables of int values
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: An approach for cheap small tables of int values
- From: Dibyendu Majumdar <mobile@...>
- Date: 2018年3月11日 01:07:52 +0000
One of the problems I have thought about for a while is how to
implement multi-dimensional array indexing efficiently. I have been
playing with Torch recently where I noticed that Lua tables are often
used as small sets of integer values representing tensor dimensions
etc.
I think it may be possible to have an optimized special case of small
table as follows:
If the table contains 1,2 or 3 int values, pack these into the TValue
itself - without any heap allocation. Then it will be quite cheap to
create these small table objects.
Of course this is just an initial thought and there are undoubtedly
implementation issues I have not foreseen.
Regards
Dibyendu