Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Fixes lua error logging and a few timer.lua functions #2540

Merged
merged 4 commits into from
Mar 25, 2024

Conversation

Steals-The-PRs
Copy link
Collaborator

Mirrored on Nova: NovaSector/NovaSector#1591
Original PR: tgstation/tgstation#82160

About The Pull Request

Lua errors don't get logged when call_function is called

Timer.start_loop was just straight up broken due to me not properly testing it, so this fixes that.

Why It's Good For The Game

Makes debugging lua scripts easier. Also fixes bugs.

Changelog

🆑 Watermelon914
fix: Fixed lua error logging.
fix: Fixed the SS13.start_loop function not working properly.
/:cl:

* Fixes lua error logging and a few timer.lua functions

* Update lua_state.dm

---------

Co-authored-by: Watermelon914 <[email protected]>
Co-authored-by: Bloop <[email protected]>
@Steals-The-PRs Steals-The-PRs added Mirroring conflict git cherry-pick во что-то уткнулся. Не ставить вручную, только для бота TG Mirror labels Mar 23, 2024
@Iajret Iajret enabled auto-merge (squash) March 25, 2024 20:42
@Iajret Iajret merged commit 2d03d1d into master Mar 25, 2024
22 checks passed
AnywayFarus added a commit that referenced this pull request Mar 25, 2024
@Iajret Iajret deleted the upstream-mirror-1591 branch March 26, 2024 20:56
Iajret pushed a commit that referenced this pull request May 18, 2024
* Micro-optimizes _SendSignal a bit (#83244)

## About The Pull Request
Instead of iterating over an assoc list and doing a list access, which
has a complexity of O(nlog(n)), it is better to just store a 2 tuple and
access that to get a complexity of O(n)
Check code to see what I mean.

## Why It's Good For The Game

![image](https://github.com/tgstation/tgstation/assets/37270891/1e5d68fa-2e19-473c-a870-e1e0277cbacc)
This is a very hot proc and it's worth micro-optimizing where we can.

The speed increase in doing the following code can be seen here:

![image](https://github.com/tgstation/tgstation/assets/37270891/1b7f00a3-b3c2-4976-b2ab-97eefbbd2459)
Higher is better.

The code that was benchmarked:
```dm
var/list/target = list()

/proc/testa()
    var/list/queued_calls = list()
    for(var/i in 1 to length(target))
        var/data = target[i]
        queued_calls.Add(data, 1)
    for(var/i in 1 to (length(queued_calls) / 2))
        var/a = queued_calls[i*2-1]
        var/b = queued_calls[i*2]

/proc/testb()
    var/list/queued_calls = list()
    for(var/data in target)
        queued_calls[data] = 1
    for(var/data in queued_calls)
        var/a = data
        var/b = queued_calls[data]

MAIN
	for(var/i in 1 to 100)
		target.Add("[i]")
    BEGIN_BENCH(2)
        BENCH_PHASE("New code", testa())
        BENCH_PHASE("Old code", testb())
    END_BENCH
```

## Changelog

---------

Co-authored-by: Watermelon914 <[email protected]>
Co-authored-by: LemonInTheDark <[email protected]>

* Micro-optimizes _SendSignal a bit

---------

Co-authored-by: Watermelon914 <[email protected]>
Co-authored-by: Watermelon914 <[email protected]>
Co-authored-by: LemonInTheDark <[email protected]>
Co-authored-by: NovaBot13 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mirroring conflict git cherry-pick во что-то уткнулся. Не ставить вручную, только для бота TG Mirror
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants