- Jun 13, 2020
-
-
Steve Bennett authored
Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
In list -> dict conversion, the new key needs to be decremented. Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
When converting a list to a dict, ensure that the last duplicate wins, not the first duplicate. Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
If a hash collision occurs and then the original entry that cased the hash collision is removed, we still need to continue iterating when searching for the new key. Don't stop at the now-empty slow. So mark these entries with offset=-1 to indicate that they need to be skipped. Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
Although the documentation has always stated that, like Tcl, insertion order of dictionaries was preserved, this has never been the case. Instead, dictionaries were implemented as simple hash tables that did not preserve order. Now, a new implementation of dictionaries preserves insertion order and has a number of other benefits. Instead of hashing keys and storing keys and values in the hash table, the keys and values are not stored in a separate table, exactly as lists are stored, with alternating key, value pairs. Iterating over the dictionary is exactly like iterating over a list, where the order is consistent. The hash table uses closed hashing rather than open hashing to avoid allocatation of hash entry structures. Instead a fixed (but expandable) hash table maps the key hash to the offset in the key/value table. This use of offsets means that if the key/value table grows, the offsets remain valid. Likewise, if the hash table needs to grow, the key, value table remains unchanged. In addition to the offset (which indexes to the value, and 0 means the hash table entry is unused), the original hash is stored in the hash table. This reduces the need for object comparisons on hash entry collisions. The collision resolution algorithm is the same as that used by Python: peturb >>= 5; idx = (5 * idx + 1 + peturb) & dict->sizemask; In order to reduce collisions, the hash table is expanded once it reaches half full. This is more conservative that Python where the table is expanded when it is two thirds full. In addition, the new faster hashing algorithm from Tcl 8.7 is used. This the hash for integers to be calculated efficiently without requiring them to be converted to string form first. This implementation is modelled largely on the Python dict implementation. Overall the performance should be an improvement over the current implementation, whilst preserving order. Dictionary creating and insertion should be faster as hash entries do not need to be allocated and resizing should be slightly faster. Entry lookup should be about the same, except may be faster for pure integer keys. Below are some indicative benchmarks. OLD NEW dict-create-1.1 Create empty dict 97.2ns . dict-create-1.2 Create small dict 440ns -27% dict-create-1.3 Create medium dict 1.54us -57% dict-create-1.4 Create large dict (int keys) 130us -80% dict-create-1.5 Create large dict (string keys) 143us -75% dict-set-1.1 Replace existing item 258ns -34% dict-set-1.2 Replace nonexistent item 365ns -49% dict-exists-1.1 Find existing item 55.7ns -5% dict-exists-1.2 Find nonexistent item 55.0ns -5% Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
- Jun 12, 2020
-
-
Steve Bennett authored
We can simply use Jim_ReplaceHashEntry() when replacing a command in non-local mode now that the proc epoch doesn't need to be incremented. And JimRemoveHashEntry() only has one caller, so fold it into Jim_DeleteHashEntry() Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
- Jun 11, 2020
-
-
Steve Bennett authored
Don't look up every object in the command table, since it can be slow to do that. Only lookup if the object looks like a reference. Also, script and expression objects can't contain references that aren't already contained in sub-objects, so there is no need to scan them for references. Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
In this case, show the result as a decimal value Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
Under some circumstances, such as lrepeat and lreverse we know the length of the final list, so allocate the final size immediately rather than growing the table in multiple steps. Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
Pass JIM_NONE to prevent an error message being generated which is subsequently thrown away. Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
- Jun 10, 2020
-
-
Steve Bennett authored
The changes in cdfa4637 broke TEST 35 because the cmd pointer is dereferenced before checking the procEpoch instead of afterwards. Signed-off-by:
Steve Bennett <steveb@workware.net.au>
-
- Jun 05, 2020
-
-
Steve Bennett authored
Now argument is Jim_Obj *, not const char * Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
If running in a VM with very variable time Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
namespace, ssl Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
Instead of incrementing the proc epoch on every command removal and some command creation, cache previous deleted commands (empty structure only). Periodically increment the proc epoch and invalide all cached commands. This is especially a win when creating short lived commands. e.g. proc a {} { local proc b {} { # do something } # now b is removed } Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
The hash table used to store commands now uses Jim_Obj keys rather than allocated char *, so embedded nulls are supported. This means that some API function such as Jim_RenameCommand() now take Jim_Obj * rather than const char *, however Jim_CreateCommand() is retained with const char * for convenience and the new Jim_CreateCommandObj() is added. This is generally a performance win as the existing Jim_Obj can be used as the key. Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
string match, switch -glob, info commands, etc. all now support patterns and strings with embedded nulls. Fixes #143 Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
Hash tables used to store variables are now use Jim_Obj keys rather than allocated char *, so embedded nulls are supported. This is generally a performance win as the existing Jim_Obj can be used as the key. Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
- May 30, 2020
-
-
Steve Bennett authored
The fix for tailcall in 0d5a208e meant that a JIM_RETURN return code from apply was no longer being converted to the appropriate return code.o Fixes: #157 Signed-off-by:
Steve Bennett <steveb@workware.net.au>
-
- May 28, 2020
-
-
D. Bohdan authored
-
- May 27, 2020
-
-
Steve Bennett authored
Fixes #155 Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
- May 23, 2020
-
-
Steve Bennett authored
An implicit concat was being done on the arguments to 'super', so arguments containing spaces were mangled. Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
- May 07, 2020
-
-
Steve Bennett authored
Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
Using a custom "expect-like" module to allow testing Jim in interactive mode. This also exercises the 'socket pty' support. Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
If the pattern begins with -, the internal invocation of regexp will treat the pattern as an option. Fix this by adding -- to the internal invocation of regexp. Fixes #154 Reported-by:
Barry Arthur <barry.arthur@gmail.com> Signed-off-by:
Steve Bennett <steveb@workware.net.au>
-
- May 06, 2020
-
-
Steve Bennett authored
Skip ipv6 tests if not supported Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
Allows a psuedo-tty pair to be created. Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
For some SSL connections it is necessary to set the Server Name Indication in the connection in order to receive the correct certificate. Allow this as part of the client ssl call with: $sock ssl -sni $servername Also for -server mode, allow the certificate and private key to be stored in a single file and only be specified once. Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
We can't use feof() and 'buffering none' on ssl connections. Instead we have to get eof from the ssl layer, and provide special handling for buffering in the eventloop. For eof, add ssl_eof() and detect SSL_read() results that indicate eof to set AIO_EOF in flags. For buffering, add 'read -pending' that will read, and then immediately read any buffered data so that the 'readable' event will trigger next time. Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
Note that there is currently a problem with ssl and readable events Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
Basic testing of each of the socket types Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
Because we use catch -exit { ... }, if a test uses os.fork we will return in both the parent in the child. To fix this, require the child to use exit 99, and detect this case and exit from the child in this case. Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
If exit is caught with catch -exit, it is currently not possible to retrieve the exit value. If an exit code is provided, set it as the interp result. Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
- May 05, 2020
-
-
Steve Bennett authored
While -D__MINGW_USE_VC2005_COMPAT enables a 64-bit time_t, it is necessary to explicitly use _stat64 to access the stat structure containing 64 bit times. Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
- May 04, 2020
-
-
Steve Bennett authored
Mostly just avoiding running certain tests, but also: - rename() won't overwrite an existing file on Windows - ensure that eof returns 0 or 1 - in aio.test, create and read the file in binary mode Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
In case the index is invalid, the string should contain -MAX_INT Signed-off-by:Steve Bennett <steveb@workware.net.au>
-
Steve Bennett authored
numPids is always zero here so the code does nothing Signed-off-by:Steve Bennett <steveb@workware.net.au>
-