Commit Graph
17586 Commits
Author SHA1 Message Date
José Valim 472c4e1a24 Avoid crashes on diagnostics with tabs, closes #14073 2024-12-16 12:09:18 +01:00
José Valim 305d8e603c Do not convert fun() into (... -> any()) and vice-versa in typespecs 2024-12-15 15:18:52 +01:00
Jonatan Kłosko 1c7fc86e9c Make :source_path in docs chunk a charlist (#14071) 2024-12-13 16:57:54 +01:00
José Valim 617dc72759 Fix Range.new deprecation assertion 2024-12-13 10:14:47 +01:00
José Valim 4329a3c2f2 Address bootstrap 2024-12-13 10:01:18 +01:00
José Valim 8e8c9a7334 Wrap Range.new in Function.identity to avoid tail call optimization 2024-12-13 09:55:39 +01:00
Michał Łępicki 36c06c3a56 Fix JSON.decode/3 spec (#14068)
The error clause was missing the :error tuple wrapping
2024-12-13 09:52:42 +01:00
Mathias Polligkeit 048cc2ddb1 Further improve warning message for range with negative step (#14070) 2024-12-13 09:52:42 +01:00
Jean Klingler 6c866e8ab2 Fix type warnings in pop_in/1 (#14064) 2024-12-12 17:47:23 +09:00
José Valim 55eca5dff5 Implement JSON.Encoder for Calendar types (#14061) 2024-12-12 00:38:44 +01:00
Panagiotis Nezis 070a6d51bf Improve warning in Range.new/2 with negative step (#14062) 2024-12-12 00:38:40 +01:00
José Valim 9c28fb7a39 Improve JSON and Float docs 2024-12-11 21:08:20 +01:00
Andrea Leopardi cda1a09c58 Improve error message on empty "mix do" (#14055) 2024-12-11 12:44:47 +01:00
José Valim 3ca0bddd9d Fix encoding specs 2024-12-11 12:16:33 +01:00
José Valim e07a91594b Update deprecations 2024-12-11 12:02:01 +01:00
José Valim dfc659104c Touch the compile path when writing .app file for the first time (#14053)
Closes #14049.
2024-12-11 10:01:00 +01:00
José Valim a78f1715dc Fix error message around single quote keywords 2024-12-10 19:30:39 +01:00
José Valim da7e04a540 Improve docs around auto_reloading 2024-12-10 19:16:09 +01:00
José Valim 66c5908619 Release v1.18.0-rc.0 2024-12-10 18:32:26 +01:00
José Valim 31d8da6c77 Avoid mtime races on compile.app_test.exs 2024-12-10 15:41:16 +01:00
José Valim 0e9b5ec070 Branch out v1.18 2024-12-10 15:01:43 +01:00
José Valim 71441623cc Update CHANGELOG and TODOs 2024-12-10 14:58:44 +01:00
José Valim aff4fdbb8e Update CHANGELOG 2024-12-10 12:49:30 +01:00
José Valim 793c114721 Add JSON encoding and decoding (#14021) 2024-12-10 12:14:30 +01:00
Alex Naser 480945a8db Load modules for mix recompile all-at-once (#14006) 2024-12-10 12:12:24 +01:00
José Valim db2a39afd2 Do not emit warnings on code generation for escript builds 2024-12-10 11:12:58 +01:00
Leif Metcalf 3f01b31ce1 Mention syntax for updating multiple map keys (#14041) 2024-12-09 12:51:52 +01:00
Łukasz Samson 9753a10158 Remove not needed macrocallback code (#14038)
This code added in 6951f0cd2a was made obsolete in aee7fbc0dc (v1.1). Correct macrocallback handling was added in 04f151b68b (v1.10) and since then macro caller arg is passed to typespecs as `term()` instead of `Macro.Env.t()`
2024-12-09 00:26:07 +01:00
José Valim 64e4b89053 Fix map ordering in earlier Elixir versions 2024-12-06 09:23:10 +01:00
José Valim beaca3b5ad Improve diff printing for when there are nested three-element tuples 2024-12-06 09:13:10 +01:00
peter madsen-mygdal 8994297ec6 Fix typo (#14033)
peformant -> performant
2024-12-05 19:02:43 +01:00
José Valim b75cccc8df Describe why Logger.flush is not advised in production 2024-12-05 13:10:58 +01:00
José Valim 4328b090ae Add Duration.to_string (#14028) 2024-12-04 16:11:10 +01:00
Ray Chang 41832ba397 Use forward slash delimiters in Regex.split doc (#14031) 2024-12-04 00:43:10 +01:00
Theodor Fiedler d49937c7bd Simplify docs for Duration.to_iso8601/1 (#14030) 2024-12-03 20:04:57 +01:00
José Valim 67573f1a6b Use binwrite on Windows, closes #14026 (#14027) 2024-12-03 18:36:23 +01:00
José Valim 768fa4963e Optimize inspection of binaries
We have used this code:

    data = Base.encode64(:crypto.strong_rand_bytes(2_000_000))

    Mix.Tasks.Profile.Tprof.profile(
      fn -> inspect(data, printable_limit: :infinity) end,
      type: :memory
    )

The first result reported this:

    Profile results of #PID<0.106.0>
    #                                    CALLS      %      WORDS PER CALL
    Total                             10666685 100.00 9268308211   868.90
    :code.ensure_loaded/1                    1   0.00          3     3.00
    Inspect.BitString.inspect/2              1   0.00          4     4.00
    Inspect.Algebra.group/2                  1   0.00          4     4.00
    Inspect.Algebra.format/2                 1   0.00          6     6.00
    Inspect.Algebra.format/3                 3   0.00          8     2.67
    :erlang.iolist_to_binary/1               2   0.00         11     5.50
    anonymous fn/2 in Kernel.struct/2        1   0.00         17    17.00
    Inspect.Opts.new/1                       1   0.00         17    17.00
    Code.Identifier.escape/5           2666669   0.06    5333344     2.00
    String.recur_printable?/2          2666669   0.29   26666778    10.00
    Code.Identifier.escape_map/1       2666668  28.72 2662035405   998.26
    Code.Identifier.escape_char/1      2666668  70.93 6574272614  2465.35

As you can see, most of the allocations were in escape_char,
which makes sense: it will be invoked a lot for raw binaries
and it allocated lists, instead of relying on binary optimizations.

We reimplemented Code.Identifier.escape/5 to rely on binary
optimizations which then yielded this:

    Profile results of #PID<0.112.0>
    #                                   CALLS      %    WORDS PER CALL
    Total                             5333350 100.00 26666864     5.00
    :code.ensure_loaded/1                   1   0.00        3     3.00
    Inspect.BitString.inspect/2             1   0.00        4     4.00
    Inspect.Algebra.group/2                 1   0.00        4     4.00
    Inspect.Algebra.format/2                1   0.00        6     6.00
    Code.Identifier.escape/4                1   0.00        8     8.00
    Code.Identifier.escape/5          2666669   0.00        8     0.00
    Inspect.Algebra.format/3                3   0.00        8     2.67
    :erlang.iolist_to_binary/1              2   0.00       11     5.50
    anonymous fn/2 in Kernel.struct/2       1   0.00       17    17.00
    Inspect.Opts.new/1                      1   0.00       17    17.00
    String.recur_printable?/2         2666669 100.00 26666778    10.00

Now the allocations are all on `recur_printable?/2`. By running this
command, we can find out why it is allocating so much:

    ERL_COMPILER_OPTIONS=bin_opt_info elixir lib/elixir/lib/string.ex

It happens that, due to a catch all, new binary contexts had to be
allocated. By addressing that, we now get:

    Profile results of #PID<0.119.0>
    #                                   CALLS      % WORDS PER CALL
    Total                             5333350 100.00    91     0.00
    :code.ensure_loaded/1                   1   3.30     3     3.00
    Inspect.BitString.inspect/2             1   4.40     4     4.00
    Inspect.Algebra.group/2                 1   4.40     4     4.00
    String.recur_printable?/2         2666669   5.49     5     0.00
    Inspect.Algebra.format/2                1   6.59     6     6.00
    Code.Identifier.escape/4                1   8.79     8     8.00
    Code.Identifier.escape/5          2666669   8.79     8     0.00
    Inspect.Algebra.format/3                3   8.79     8     2.67
    :erlang.iolist_to_binary/1              2  12.09    11     5.50
    anonymous fn/2 in Kernel.struct/2       1  18.68    17    17.00
    Inspect.Opts.new/1                      1  18.68    17    17.00

Which is several orders of magnitude fewer words. We basically
allocate the new escaped binary and a few extra bytes.

Closes #14029.
2024-12-03 18:34:59 +01:00
Eksperimental eadbd8bdf3 Fix typos (#14023)
The typos were detected by this app: https://pypi.org/project/typos/
running the following command

    typos --exclude "lib/elixir/unicode/" --exclude "man/" --exclude "typos"  --format brief
2024-12-01 16:59:24 +01:00
José Valim d97b29fa64 Improvements to comparison docs 2024-11-30 15:49:02 +01:00
José Valim b087a7501b Keep struct fields in calendar sigil for better pretty printing 2024-11-30 15:44:05 +01:00
José Valim 44107f1010 Precreate the compilation path to avoid mtime races 2024-11-29 13:42:13 +01:00
maintenance-beam-app 13d3cc0a3f Update Unicode to version 16.0.0 (#14024)
This is an automated commit created by the Maintenance project
https://github.com/eksperimental/maintenance

Before merging, please read the release notes by visiting
<http://www.unicode.org/versions/Unicode16.0.0/>
and assess if additional changes are necessary in the code base.
2024-11-29 10:01:27 +01:00
José Valim 521216f427 Do not assert time on CI to avoid failures 2024-11-29 10:01:10 +01:00
José Valim afc99e2ca4 Fix local installer warnings 2024-11-27 21:16:23 +01:00
José Valim ede345f3e9 Clean up app start logs 2024-11-27 21:12:42 +01:00
José Valim 80993a465a Update docs generation config 2024-11-27 20:46:52 +01:00
José Valim 13f527aaa7 Use arity() consistently 2024-11-27 18:56:22 +01:00
José Valim e3bad83233 Move __deriving__ callback to the protocol 2024-11-27 18:38:48 +01:00
José Valim 1f98708649 Add @undefined_impl_description 2024-11-27 18:38:48 +01:00
12780b15dd Add project/0 warning (#14016)
Co-authored-by: Alex Naser <alex.naser@remote.com>
Co-authored-by: José Valim <jose.valim@gmail.com>
2024-11-25 17:04:02 +01:00