Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 07 2019 18:54
    @timsneath banned @hpoit_gitlab
  • Aug 07 2019 18:54
    @timsneath banned @hpoit
  • Jan 31 2019 22:29

    dart-bot on master

    Add pkg/analysis_server/pubspec… (compare)

  • Jan 31 2019 22:12

    dart-bot on master

    First stab at tests for "Spread… (compare)

  • Jan 31 2019 22:10
    jackokring opened #35830
  • Jan 31 2019 21:14

    dart-bot on master

    [vm, gc] Use work stealing for … (compare)

  • Jan 31 2019 21:05

    dart-bot on master

    [vm] Simplify VirtualMemory::Tr… (compare)

  • Jan 31 2019 20:15
    renatoathaydes opened #35829
  • Jan 31 2019 20:13

    dart-bot on master

    [vm] Maintain view-ness of byte… (compare)

  • Jan 31 2019 19:59

    dart-bot on master

    Add the capability in analysis … (compare)

  • Jan 31 2019 19:35
    jmesserly closed #33685
  • Jan 31 2019 19:19
    srawlins opened #35828
  • Jan 31 2019 18:35

    dart-bot on master

    Add a "summary-deps-output" opt… (compare)

  • Jan 31 2019 18:33

    dart-bot on master

    Extract EnumListParameter value… (compare)

  • Jan 31 2019 18:09

    dart-bot on master

    Fix override_on_non_overriding_… (compare)

  • Jan 31 2019 17:46
    stereotype441 labeled #35827
  • Jan 31 2019 17:46
    stereotype441 labeled #35827
  • Jan 31 2019 17:46
    stereotype441 labeled #35827
  • Jan 31 2019 17:46
    stereotype441 opened #35827
  • Jan 31 2019 17:23
    srawlins edited #35826
✭ THE BLACK UNICORN ✭
@iamtheblackunicorn
I just assumed having conversed a lot in the past, we were on a somewhat more informal track.
And kindly elaborate on "people like me"?
However, when I slap 0FF into this website, it gives me 256.
Randal L. Schwartz
@RandalSchwartz
I mean, apparently, I’m seen as someone who often has correct answers and people want correct answers sometimes DM me directly instead of letting me take my time to notice their public posting. That annoys me extremely, as I’m clearly not the only person capable of answering their question. And it doesn’t scale.
Actually, my technique for answering is more “shotgun aimed at the low hanging fruit”. If I answer enough simple questions, most of them are bound to be right, and I get seen as having… skills. :)
Simon Binder
@simolus3
I think the problem is that you're using the respective char as power, when you should just be using 16 for hexadecimal. E.g you should do result = result * base + digitSet.indexOf(hexChar) and initialize the result to zero. If you want to use powers, you should add digit * 16ⁱ, where i is the index in the original number.
Don
@donny-dont
https://api.flutter.dev/flutter/dart-core/int/parse.html you can give it a radix in this case 16 for hex
Jacob Bang
@julemand101
@donny-dont I think the point here is to learn something and not just use a method from the language SDK :P
Don
@donny-dont
realistically software is all use whatever libraries are there for you
but yea i get it i had just used that recently for parsing
Jacob Bang
@julemand101

realistically software is all use whatever libraries are there for you

Not even close in my company. A lot of libraries comes with licenses which needs to be understood before just using them. The problem is some licenses does not allow you to use them in e.g. closed source products. Also, it is always a problem having lots of dependencies since you always needs to keep them updated

But yes, if the language itself has some functionality. Please use it! :D
Don
@donny-dont
i mean whatever libraries/functionality is approved to use you should use it
but yea if its a learning exercise go for it
David
@Lootwig
    if (digitSet.contains(hexChar) == true){
@iamtheblackunicorn Is this considered more readable?
hacker1024
@hacker1024
Is there a way to measure the amount of memory an object takes up?
I'm trying to decide how many objects to cache in memory before discarding them.
Jacob Bang
@julemand101
@hacker1024 Not really a question that is possible to answer. What should be consider "memory an object takes up"? What if you have shared data between objects?
hacker1024
@hacker1024
I don't in this case. But I see your point.
I guess I'd consider memory as used by an object if the garbage collector could collect it after the object is no longer used.
Jacob Bang
@julemand101
@hacker1024 Dart does not (yet?) have weak references since JavaScript does only have them recently
hacker1024
@hacker1024
I know. I mean if the only reason why an object is still in memory is because it's referenced by a single other object, I'd consider it part of that other object's memory footprint.
Jacob Bang
@julemand101
I would think the best you can do is having a DoubleLinkedQueue of some sort which you keep a fixed size. You will then move objects when you access them and when you need to add a new object, you will remove the last from the queue
hacker1024
@hacker1024
That's what I plan to do, but I need to decide that maximum size.
Jacob Bang
@julemand101
make it an option based on number of objects. Or are your objects very different in size?
hacker1024
@hacker1024
They should all be fairly similar. What do you mean by "based on the number of objects"?
Jacob Bang
@julemand101
Just a number of entries in your queue.
You could keep 5000 objects in your queue
hacker1024
@hacker1024
Right, but I need to choose how many. Why 5000, and not 200000?
Jacob Bang
@julemand101
that is why I would just make in an option. You can then tweak it in production
hacker1024
@hacker1024
I still need to decide eventually based on something
Hence my initial question
Jacob Bang
@julemand101
You can analyze memory consumption using the Dart observatory.
For the overall application
hacker1024
@hacker1024
Thanks. I'll give that a shot
Jacob Bang
@julemand101
Also take a look at the more fancy interface, Devtools: https://dart.dev/tools/dart-devtools#using-devtools-with-a-command-line-app
You can also get all this information in your Dart code but only if you are running your code in observe mode which should not be used in production
So in the end, you would need to figure this out without using this metrics in production
hacker1024
@hacker1024
Thanks
Jacob Bang
@julemand101
But best solution would be weak references since they can point to objects but still allow them to be garbage collected. It is just not a feature in Dart :)
hacker1024
@hacker1024
Well, I want to dedicate some memory to the caching
I don't want them all to be garbage-collectable at once
Jacob Bang
@julemand101
The next best you can do here is using Expando which is a Map where the key is a given object. You can then attach extra data to a object and be sure this data is removed by the garbage collector when the object is GC'ed. (so the Expando itself does not keep the object in memory)
hacker1024
@hacker1024
Ah wow, that's perfect for my usecase. Thanks!
Jacob Bang
@julemand101
Keep in mind that you don't have any limits here. Data is purely removed from the Expando when nothing else is referring to the object (since it would then be impossible to point to the key in the Expando). :)
hacker1024
@hacker1024
Yup
Jacob Bang
@julemand101
(Also a neat trick if you want to create an extension method for an object and want to add some extra data without the need of extending the class)
(You can just make a static Expando in the extension)
hacker1024
@hacker1024
I'll think I'll make a caching abstraction that lets me swap out Expando for a Queue instead
Jacob Bang
@julemand101
(there are properly also packages on pub.dev which provides caching behavior. I have just not researched it)
Randal L. Schwartz
@RandalSchwartz
Expando is weak references