Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:25
erlang
0226-prim_file-read_file_info-2-avoid-copying-t...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0226-prim_file-read_file_info-2-avoid-copying-the-record-.patch of Package erlang
From 5c07885c6b14f0017fd5b05f7caed529a0eb83aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Muska=C5=82a?= <micmus@fb.com> Date: Thu, 19 Jan 2023 13:03:03 +0000 Subject: [PATCH] prim_file:read_file_info/2 avoid copying the record for posix time read When requested time format is already posix, we don't need to adjust anything, but the old code would still copy the #file_info record, we can skip the adjustments a function earlier and avoid this copy. Before `prim_file:read_file_info("mix.exs", [raw, {time, posix}])` would allocate 432 bytes, now it only allocates 312 bytes. --- erts/preloaded/src/prim_file.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erts/preloaded/src/prim_file.erl b/erts/preloaded/src/prim_file.erl index 3538b4fbba..29daf80229 100644 --- a/erts/preloaded/src/prim_file.erl +++ b/erts/preloaded/src/prim_file.erl @@ -653,6 +653,8 @@ read_handle_info_1(Fd, TimeType) -> error:_ -> {error, badarg} end. +adjust_times(FileInfo, posix) -> + FileInfo; adjust_times(FileInfo, TimeType) -> CTime = from_posix_seconds(FileInfo#file_info.ctime, TimeType), MTime = from_posix_seconds(FileInfo#file_info.mtime, TimeType), @@ -877,8 +879,6 @@ is_path_translatable(Path) -> %% We want to use posix time in all prim but erl_prim_loader makes that tricky %% It is probably needed to redo the whole erl_prim_loader -from_posix_seconds(Seconds, posix) when is_integer(Seconds) -> - Seconds; from_posix_seconds(Seconds, universal) when is_integer(Seconds) -> erlang:posixtime_to_universaltime(Seconds); from_posix_seconds(Seconds, local) when is_integer(Seconds) -> -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor