I know that printing a lot can make some Python code run slower (I've tested it and referenced this question). However, I'm not sure if printing a lot makes some Flutter code run slower.
I didn't include the code because I don't think code has anything to do with this and I don't have the code to test it.
Feel free to leave a comment if you need more information.
Does printing a lot make some Flutter code run slower? I would appreciate any help. Thank you in advance!
Well, we preferably use print() in debug mode only. By default, print is disabled in release build of your app, if I'm correct. Unless you call print in loop for over thousand times, it wouldn't have much of an impact on average phones
Flutter does not recommends print() in release mode
Juse use as below code
void prints(var s) {
if (kDebugMode) {
print(s);
}
}
Related
When developing a project in Objective-C everything is smooth, SourceKitService is taking 0% of CPU, autocompletion is almost instant.
But if I change a Swift code a bit, it takes many seconds to do anything (highlight syntax and check, whisper etc.) Or when i want to see an implementation of something with cmd shortcut, again SourceKitService on xxx% of CPU and takes seconds. Changing a character in code leads to 10 seconds of waiting to see everything is ok is too much.
Sure I tried to delete derivedData, ModuleCache, com.apple.dt.Xcode etc. as advised but it is not permafix, still happening, slowing me down.
Does anybody know how to really fix this issue or at least improve it?
I would recommend trying the Build Time Analyzer to see if there are specific things slowing down the compiler. In my experience the main problem is complex Type inference, usually from multiple chained .maps, complex associated types and, generics.
The Swift compiler is doing a lot more and is quite a bit newer than the Objective-C compiler so it unlikely it will be as stable/fast for quite some time. I know compile time and IDE stability is something they're aware is a problem and are working to improve. Hopefully now that we have (promised) source compatibility some of this things will be fixed our greatly improved within the next year. Unfortunately we'll probably have to jump through some hoops until that point.
In this case it had something to do with CocoaPods. It was copying .h files into the build directory and SourceKit was getting confused.
I added this script to my project, and SourceKit stopped freaking out a bit, but it is still ridiculously slow.
function removeHeaders() {
find $BUILD_ROOT/Debug-iphonesimulator/ -name '*.h' -exec rm -f {} \;
}
removeHeaders
Ref. Xcode Swift Syntax Highlighting and Code Completion Completely Broken
Note: Unfortunately this solution breaks debugging console and archiving. So remove the script if it is needed.
I use karma to run jasmine specs. Every time a file changes the tests are run. This is awesome but it would be even better if the previous test output would be removed from the terminal.
Is there a way to clear the terminal before tests are run in karma?
It is not supported. I like this idea though. I created issue #1004 to support this.
The issue #Sylvain has created is still open, but there is a plugin karma-clear-screen-reporter which does the job. Internally it uses the magic:
console.log('\u001b[2J\u001b[0;0H');
Alternatively you can also place this at the top of your test runner code to clear the console yourself.
Context
My answer is the same as #bluenote10
The difference is that I made some improvements to the package he posted and published it on my github:
Karma Clear Screen
Improvements
Improvement in the initial message.
Date of the update.
In addition to console.log('\u001b[2J\u001b[0;0H'); the spacing has been improved.
When i try to start a simulation that has been successfully executed before. I get two errors. Fist of them is a Model error. Second is the title. Here are the details:
Since i'm pretty much beginner in MATLAB, i tried to do some research in order to solve the problem, but the instructions wasn't simple enough to understand. What i really want to do is, execute the simulation, see how it works, and imitate the running function.
Sorry if the question is to lame to ask, but like i said, i had to start somewhere.
Marty, it's nice to see you still struggling to learn some cs stuff.
Now, listen to me carefully. That's not a real bug or something that happened because of your wrongdoings.
That's just one of the few things that happens when you use outdated software. Let me guess, u used MATLAB 9, right? Well, i guess this was your problem. Try version 10 instead.
We'll meet again.
In XCode 3.2.2 completion works whenever it chooses to.
One time it will, one time it won't.
Is there some flag or add-on to increase the auto-completion success rate ???
Is there maybe a better code editor that can link to xcode in a good manner which has better coding capabilities then XCode ?
Thanks
I don't know. Maybe it depends on the way you code but it works for me most of the time. There is some case that it will not work, for example, too much complicated like [[self.a doB] doC];
Can you post me some code that it doesn't work for you?
My iphone app randomly received this message. I know certain it is memory release problem. However what is the best way to find which object leads this problem. Here are what I have tried
Use Instrument Leak and
ObjectAllocation Trace. Dont saw any
help to know which object have this
problem
Put NSZombieEnabled=YES and project executive ... Dont saw any
help either
Put NSLog everywhere but the EXE_BAD_ACCESS just appear anywhere.
in the debuger, just saw the code
happened in the assembly. like
objc-msg send.
review code many times and read memory management a lot time
and research online a lot time. but
no surprise.
Is there a completed solution to figure out this problem easily. I am a previous Visual C++ programmer, I deal with memory management with years and it is easy to debug and figure out in Visual C++.
If you couldn't see any helpful debug info, I would suggest you find all the places that you are doing a release. It is most likely the case that you have released something that did not need to be released. Code would help us in tracing the issue with you.
As Juan noted, the first stop is the Debugger - what does the debug window give for a stack trace when the app crashes? You should be able to see the line it crashed on... you said in a comment to one response that you saw the crash happen around the lines:
CGPDFDocumnetRef docA=CGPDFDocumentCreatWithURL(myurl);
CGPDFDocumnetRef docB=CGPDFDocumentCreatWithURL(myurl);
Are you really using the same URL object for both calls? Which line is it exactly?
It could be something around the way you make use of the CGPDFDocumentRef, you can find example code how Apple uses them in the QuartzDemo project, file "QuartzImageDrawing.m" (you can find the demo project from the developer portal or embedded in the iPhone documentation with XCode).
XCode is actually pretty powerful, but it does things differently from other IDE's.
In addition to Erich answer, I'd want to add go backward. Start with the most recently added release and work from there.
I ran in to this and it turned out I was releasing an auto-released object that was returned from a convenience method built in to the Cocoa-Touch framework. My problem was as Erich described -- I released this auto-released object. When the system attempted to release it, the program gave the error you are describing.
Regards,Frank
The best way to know what happend is using the xCode Debbuger, give it a try.
You will also receive the message when you don't pass enough parameters to a variable argument method. For example having a NSLog statement like this: NSLog(#"Hello %#");
To check what the error might be
Use NSZombieEnabled.
To activate the NSZombieEnabled facility in your application:
Choose Project > Edit Active Executable to open the executable Info window.
Click Arguments.
Click the add (+) button in the “Variables to be set in the environment” section.
Enter NSZombieEnabled in the Name column and YES in the Value column.
Make sure that the checkmark for the NSZombieEnabled entry is selected.
found this on iPhoneSDK